import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.*;
import java.util.concurrent.*;

interface Person{
    Person getPerson();
}
abstract class Person1{
    abstract void fun11();
    public Person1 fun22(){
        System.out.println("3334");
        return new Person1() {
            @Override
            void fun11() {

            }
        };
    }
}
class Student extends Person1 implements  Person{
    private  int id;
    private  String name="abcccc";

    public int tmp;
    private static int ok;

    public void fun4(){
        Emp emp = new Emp();
        emp.fun2();
        System.out.println(emp.b);
    }

    @Override
    public Student fun22() {
        System.out.println("233");
        return new Student();
    }

    public Student(){


    }

    public void sum(int a,String b){
        System.out.println("111");
    }

    public  void   sum(String b,int a){
        System.out.println("222");
    }



    static class Emp{
        private  static int a;
        private int  b;
        private  int ok;
        private  static void fun2(){
            System.out.println(Student.ok);
            System.out.println();
        }
    }

    @Override
    void fun11() {

    }

    @Override
    public Student getPerson() {
        return null;
    }

    private  Student(int id, String name){
        this.id=id;
        this.name=name;
    }
}

class MyComparator implements Comparator<Student> {

    @Override
    public int compare(Student o1, Student o2) {
        return o1.tmp-o2.tmp;
    }
}

class MyComparator2 implements Comparator<Integer>{
    @Override
    public int compare(Integer o1, Integer o2) {
        return o1-o2;
    }
}
public class Test2 {


    public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, NoSuchFieldException, ExecutionException, InterruptedException {

    Student student1 = new Student();
    student1.tmp=10;
    Student student2 = new Student();
    student2.tmp=12;
    MyComparator myComparator = new MyComparator();
    int outcome = myComparator.compare(student1,student2);
    if(outcome<0){
        System.out.println("学生2赢");
    }else if(outcome>0){
        System.out.println("学生1赢");
    }else{
        System.out.println("平局");
    }
   Class<?> classes = Class.forName("Student");
     Student student = (Student) classes.newInstance();
     student.fun22();
   ClassLoader student3 =  classes.getClassLoader();
     Constructor<?> student4 = classes.getConstructor();
    Student student5 = (Student) student4.newInstance();
    student5.fun22();
   Field field = classes.getDeclaredField("name");
Thread thread1 = new Thread(()->{
    Thread.currentThread().isInterrupted();
    System.out.println("1111");
});

        ExecutorService service = Executors.newFixedThreadPool(10);

        Callable<Integer> callable = new Callable<Integer>() {
            @Override
            public Integer call() throws Exception {
                System.out.println("11");
                return 1;
            }
        };

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("111");
            }
        };
service.execute(runnable);
       Future future = service.submit(callable);
       int a = (int) future.get();
        System.out.println(a);

        Set<Integer> set = new HashSet<>();
        set.add(1);
      set.add(1);
      set.add(2);
      set.add(2);
        System.out.println(set.size());
        List<Integer> list = new LinkedList<>();
        list.add(10);
        list.add(9);
        list.add(7);
        list.add(8);
        list.add(4);
        list.add(5);
        System.out.println(list);
        list.sort(new MyComparator2());
        System.out.println(list);
        ConcurrentHashMap<Integer,String> concurrentHashMap = new ConcurrentHashMap<>();
        Hashtable<Integer,Integer> hashtable = new Hashtable<>();
        HashMap<String,Integer> hashMap = new HashMap<>();
        hashMap.put("a",1);
        hashMap.put("b",2);
        hashMap.put("c",3);
        hashMap.put("d",4);
        hashMap.put("f",5);
        for(String key:hashMap.keySet()){
            System.out.println("key："+key+" "+"value:"+hashMap.get(key));
        }
    }
}
